package org.pay.core.common.domain;

import org.pay.core.common.constant.RetEnum;
import org.pay.core.common.util.MyLog;

import java.io.Serializable;

/**
 * @author: yangshancheng
 * @date: 17/11/29
 * @description:
 */
public class PayPageRes extends PayResponse implements Serializable {

    private static final long serialVersionUID = 1250166508152483573L;

    private static final MyLog _log = MyLog.getLog(PayPageRes.class);

    public int count;     // 记录总数

    public PayPageRes(RetEnum retEnum, Object data, int count) {
        super(retEnum, data);
        this.count = count;
        _log.info(this.toString());
    }

    public static PayPageRes buildSuccess(Object data, int count) {
        PayPageRes payResponse = new PayPageRes(RetEnum.RET_COMM_SUCCESS, data, count);
        return payResponse;
    }

    public static PayPageRes buildSuccess() {
        PayPageRes payResponse = new PayPageRes(RetEnum.RET_COMM_SUCCESS, null, 0);
        return payResponse;
    }

    public int getCount() {
        return count;
    }

    public void setCount(int count) {
        this.count = count;
    }

    @Override
    public String toString() {
        return "PayPageRes{" +
                "count=" + count +
                ", code=" + code +
                ", msg='" + msg + '\'' +
                ", data=" + data +
                '}';
    }
}
